<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
</head>
<body>
    <input type="file">
    <script>
        //获取元素
        var ele=document.querySelector('input')
        //点击事件
        // ele.addEventListener("change",function(e){
        //     let file=e.target.files[0]
        //     let form=new FormData()
        //     axios.get('http://123.206.55.50:11000/upload',form)
        // })
        ele.addEventListener('change',function(e){
            let file=e.target.files[0]
            let reader =new FileReader()
            reader.readAsDataURL(file)
            reader.onload=function(result){
                //发送请求
                axios({
                    method:'post',
                    url:'http://123.206.55.50:11000/upload_base64',
                    data:{base64:this.result}
                }).then(body=>{
                    console.log('body....',body)
                }).catch(e=>{
                    console.log('e....',e)
                })
            }
        })
    </script>
</body>
</html>